<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>7_3_2-组合式的生命周期</title>
</head>

<body>


    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>

    <div id="Application">
        <com name="组件名"></com>
    </div>
    <script>
        const App = Vue.createApp({});
        App.component("com", {
            setup(props, context) {
                let data = "setup数据";
                //设置的函数参数的调用时机与mounted一样
                Vue.onMounted(() => {
                    console.log("setup定义的mounted-1");
                });
                console.log("简简单单-2");
                return () => Vue.h("div", [data]);
            },
            props: {
                name: String,
            },
            mounted() {
                console.log("组件内部定义的monted-3");
            },
        });

        App.mount("#Application");
    </script>
</body>

</html>